AUTOMAKE_OPTIONS = gnu

sbin_PROGRAMS = banssh audisp-bot peek bansshcpp bheartbeat 
bin_PROGRAMS = peek 

bansshcpp_SOURCES = src/bansshcpp.cc src/commoncpp.cc src/thread_wrappercpp.cc  src/confcpp.cc  src/reentrantcpp.cc src/ipumap.cc
bansshcpp_LDADD = @INCLUDES@ @LIB_CFLAGS@ 
bansshcpp_CXXFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread @BANSSH_SYSLOGMSGS@

banssh_SOURCES = src/banssh.c src/common.c src/conf.c src/engine.c src/reentrant.c src/thread_wrapper.c
banssh_LDADD = @INCLUDES@ @LIB_CFLAGS@ 
#banssh_CFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread 
banssh_CFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread @BANSSH_SYSLOGMSGS@

peek_SOURCES = src/peek.c src/common.c src/conf.c src/engine.c src/reentrant.c src/thread_wrapper.c
peek_LDADD = @INCLUDES@ @LIB_CFLAGS@ 
peek_CFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread @BANSSH_SYSLOGMSGS@

bheartbeat_SOURCES = src/bheartbeat.c src/common.c src/conf.c src/engine.c src/reentrant.c src/thread_wrapper.c
bheartbeat_LDADD = @INCLUDES@ @LIB_CFLAGS@ 
bheartbeat_CFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread @BANSSH_SYSLOGMSGS@

audisp_bot_SOURCES = src/audisp-bot.c src/common.c src/conf.c src/engine.c src/reentrant.c src/thread_wrapper.c
audisp_bot_LDADD = @INCLUDES@ @LIB_CFLAGS@ 
audisp_bot_CFLAGS = -W -O2 -s -pipe -lssl -lcrypto -lauparse -laudit -pthread @BANSSH_SYSLOGMSGS@

man_MANS = man/banssh.1

#include_HEADERS = src/bansshcnf.h  src/common.h  src/conf.h  src/engine.h  src/reentrant.h src/ipumap.h src/thread_wrapper.h


EXTRA_DIST = $(man_MANS) VERSION update.sh python/AttacksAudit.py python/logintest.py python/bansshHb.py init.d/bheartbeat init.d/bansshd init.d/bansshdHB src/Makefile certs/client.cnf  certs/root.cnf  certs/serverCA.cnf  certs/server.cnf certs/Nopass.sh certs/Makefile certs/install.sh certs/Nopass.sh etc/banssh.conf update.sh src/audisp-bot.conf  src/bansshcnf.h  src/common.h  src/conf.h  src/engine.h  src/reentrant.h src/ipumap.h src/thread_wrapper.h banssh.spec


install-exec-hook:
	mkdir -p /etc/banssh
	mkdir -p /var/log/banssh
	mkdir -p /var/log/banssh/lock
	cp init.d/bansshd /etc/init.d/bansshd 
	cp init.d/bansshdHB /etc/init.d/bansshdHB
	cp init.d/bheartbeat /etc/init.d/bheartbeat
	cp src/audisp-bot.conf  /etc/audisp/plugins.d/.
	chcon -u system_u /etc/audisp/plugins.d/audisp-bot.conf
	test -f /etc/banssh/banssh.conf || cp etc/banssh.conf /etc/banssh.conf
	test -f /etc/banssh/serverkey.pem || cd certs && make
	chmod 644 /etc/banssh/banssh.conf
	chcon -u system_u /etc/banssh/banssh.conf
	chcon -u system_u $(sbindir)/audisp-bot
	chcon -t audisp_exec_t $(sbindir)/audisp-bot
	chcon -u system_u $(sbindir)/banssh
	chcon -u system_u $(sbindir)/bansshcpp
	cp python/AttacksAudit.py  $(sbindir)/AttacksAudit.py
	cp python/bansshHb.py  $(sbindir)/bansshHb.py
	chcon -u system_u $(sbindir)/AttacksAudit.py 
	chcon -u system_u $(sbindir)/bansshHb.py
	






